package com.itheima.docker.service.serviceimpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.itheima.docker.mapper.DockerMapper;
import com.itheima.docker.pojo.Docker;
import com.itheima.docker.service.DockerService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


@Transactional
@Service
public class DockerServiceImpl extends ServiceImpl<DockerMapper, Docker> implements DockerService {
    @Override
    public Integer saveAndUpdate(String ip) {

        String url = baseMapper.findDocekersBycontextPath();
        if(url == null){
            baseMapper.insertDockers(ip);
        }else {
            baseMapper.updateDockers(ip);
        }
        return baseMapper.findDocekers();
    }
}
